# Maintainer: Jelle van der Waa <jelle@archlinux.org>

libgmobile_commit=f4d4e5740c3e4b2de40864ab8a9e7b7f957d6aec

pkgname=phoc
pkgver=0.33.0
pkgrel=2
pkgdesc='Display compositor designed for phones'
arch=(loong64 x86_64 aarch64)
url='https://gitlab.gnome.org/World/Phosh/phoc'
license=(GPL3)
depends=(gnome-desktop wlroots0.16 gsettings-desktop-schemas pixman libinput libxcb libxkbcommon
	 json-glib glib2 dconf cairo wayland)
checkdepends=(xorg-server-xvfb xorg-xauth mutter pixman)
makedepends=(cmake meson git wayland-protocols python-jinja python-pygments python-typogrify libgirepository)
optdepends=('xorg-wayland: run X clients under phoc')
source=(https://gitlab.gnome.org/World/Phosh/phoc/-/archive/v${pkgver}/${pkgname}-v${pkgver}.tar.gz
	https://gitlab.gnome.org/guidog/gmobile/-/archive/${libgmobile_commit}/gmobile-${libgmobile_commit}.tar.gz)
sha256sums=('fe32ff8e1977ef5ae4fc15434ceb01e9291cda089548d77507af2cdcd4550063'
            'b071e21a30eb8649b2bd9f416eec97110f0f08090b6c230e928ef1c3339ac344')

prepare() {
  mv "gmobile-${libgmobile_commit}" "${pkgname}-v${pkgver}/subprojects/gmobile"
}

build() {
  export PKG_CONFIG_PATH='/usr/lib/wlroots0.16/pkgconfig'
  arch-meson "${pkgname}-v${pkgver}" build -Dembed-wlroots=disabled
  meson compile -C build
}

check() {
  LC_ALL=C.UTF-8 WLR_RENDERER=pixman xvfb-run meson test -C build --print-errorlogs
}

package() {
  depends+=(libwlroots.so=11)
  DESTDIR="${pkgdir}" meson install -C build
}
